<?php
include('tryPHP/tryLibrary/uploader.php');
$up=new Uploader('cover');
$up->Size=1024*1024*2;
$up->Path=dirname(__FILE__).'/UploadFiles_s';
$up->FileExtension=array('gif','jpg','png','bmp');
$up->Execute();
switch($up->ErrorCode){
    case Uploader::UPLOAD_ERR_OK:
        $data['photos']=$up->Filename;
    break;
    case Uploader::UPLOAD_ERR_NO_FILE:
        $error='请上传封面图片。';
    break;
    case Uploader::UPLOAD_ERR_EXTENSION:
        $error='封面图片格式只允许gif、jpg、png、bmp，请重新上传。';
    break;
    case Uploader::UPLOAD_ERR_CUSTOM_SIZE:
        $error='封面图片超过了500K，请重新上传。';
    break;
    default:
        $error='封面图片上传失败，请重新上传。';
        //$error=$up->ErrorMessage;
    break;
}